#include "NvLogger.h"

NvLogger::NvLogger(nvinfer1::ILogger::Severity level)
    :level(level)
{}

void NvLogger::log(nvinfer1::ILogger::Severity severity, nvinfer1::AsciiChar const* msg) noexcept{
    if(severity <= level){
        qDebug() << "TensorRT: ";
        switch(severity){
            case nvinfer1::ILogger::Severity::kINTERNAL_ERROR:
                qDebug() << "Internal Error: " << QString(msg);
                break;
            case nvinfer1::ILogger::Severity::kERROR:
                qDebug() << "Error: " << QString(msg);
                break;
            case nvinfer1::ILogger::Severity::kWARNING:
                qDebug() << "Waring: " << QString(msg);
                break;
            case nvinfer1::ILogger::Severity::kINFO:
                qDebug() << "Info: " << QString(msg);
                break;
            default:
                qDebug() << "Debug: " << QString(msg);
                break;
        }
    }

}
